#define loginForm()
<div class="container">
	<form id="loginForm" class="form-signin">
		<h2 class="form-signin-heading">MGO</h2>
		<label for="inputUsername" class="sr-only">用户名</label>
		<input type="text" id="inputUsername" class="form-control" placeholder="用户名" required autofocus>
		<label for="inputPassword" class="sr-only">密码</label>
		<input type="password" id="inputPassword" class="form-control" placeholder="密码" required>
		#if(captcha_enable)
		<label for="randomCode" class="sr-only">验证码</label>
		<input type="text" id="randomCode" class="form-control" placeholder="验证码" required autocomplete="off">
		<img id="captchaImage" src="#(homeurl ??)/captcha" onclick="refreshCode()"/>
		#end
		<div id="loginInfo" class="alert alert-danger" role="alert" style="display:none"></div>
		<button class="btn btn-lg btn-primary btn-block" type="submit">登陆</button>
		<button class="btn btn-lg btn-primary btn-block" type="button" onclick="toReg()">注册</button>
		<a href="https://api.weibo.com/oauth2/authorize?client_id=#(weibo_appid ??)&response_type=code&redirect_uri=http://#(weibo_url ??)/account/weiboLogin" class="btn btn-block btn-sm btn-danger" role="button" id="weiboLogin">微博登录</a>
	</form>
</div>
<script type="text/javascript">
	$("#loginForm").submit(function(e){
		var username = $("#inputUsername").val();
		var userpass = $("#inputPassword").val();
		var randomCode = $("#randomCode").val();
		$("#loginInfo").hide();
		$.post("#(homeurl ??)/account/login",{username:username,userpass:userpass,randomCode:randomCode},function(data){
			if(data.isFail){
				$("#loginInfo").html(data.msg);
				$("#loginInfo").slideDown();
				refreshCode();
			}else{
				location.reload();
			}
		});
		return false;
	});
	
	function refreshCode() {
		$("#captchaImage")[0].src = "#(homeurl ??)/captcha?rnd="+new Date().getTime();
	}
	
	function toReg(){
		location="#(homeurl ??)/reg";
	}
</script>
#end

#define loginFormCSS()
<style type="text/css">
.form-signin {
  max-width: 330px;
  padding: 15px;
  margin: 0 auto;
}
.form-signin .form-signin-heading {
  margin-bottom: 10px;
}
.form-signin .form-control {
  position: relative;
  height: auto;
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
  padding: 10px;
  font-size: 16px;
}
.form-signin .form-control:focus {
  z-index: 2;
}
.form-signin input[type="text"] {
  margin-bottom: -1px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
  margin-bottom: 10px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
</style>
#end